<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Jhub1_Admin\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Jhub1_Common\Entity\BO\UsersBO;
use Jhub1_Admin\Form\Registration;
use Jhub1_Admin\Model\FormFilter\RegistrationFilter;
use Zend\Session\Container;


class OptionsController extends AbstractActionController
{

    /**
     * This is modal content
     * @return ViewModel
     */
    public function listtimezoneAction()
    {
        $all = $this->getTimezones();
        /*        $timezoneSvc = $this->getServiceLocator()->get('Application\Service\TimezoneService');
                var_dump($timezoneSvc->getListOfTimezones());
                die;*/

        $view = new ViewModel(array('timezones' => $all));
        $view->setTerminal(true);
        return $view;
    }

    /**
     * This is modal content
     * @return ViewModel
     */
    public function listlanguageAction()
    {

        $view = new ViewModel();
        $view->setTerminal(true);
        return $view;
    }

    /**
     * This is modal content
     * @return ViewModel
     */
    public function listdateformatAction()
    {

        $view = new ViewModel();
        $view->setTerminal(true);
        return $view;
    }

    /**
     * This is modal content
     * @return ViewModel
     */
    public function listtimeformatAction()
    {

        $view = new ViewModel();
        $view->setTerminal(true);
        return $view;
    }

    private function getTimezones()
    {
        $all = timezone_identifiers_list();
        $zonen = array();
        foreach ($all AS $zonem) {
            $zone = explode('/', $zonem);
            $continent = isset($zone[0]) ? $zone[0] : 'none';
            $city = isset($zone[1]) ? $zone[1] : '';
            $subCity = isset($zone[2]) ? $zone[2] : '';
            $zonen[$continent][] = array( 'continent' => $continent,
                                          'city' => $city,
                                          'subcity' => $subCity,
                                          'zone' => $zonem);
        }
        return $zonen;
    }

}